import config from "./config.json";
import React, { Component } from 'react';
import styles from './Greeter.css';

export default class Greeter extends Component {
    constructor(props) {
        super(props);

        const maps = new Map();
        const testKey = 'key';
        maps.set(testKey, '1');
        const arr = [1, 2, 3];
        const arr2 = [4, ...arr];

        this.state = {
            greetText: config.greetText + maps.get(testKey) + arr2.join('-')
        }
    };

    changeText = () => {
        this.setState({
            greetText: this.state.greetText + "1"
        })
    };
    render() {
        const { greetText } = this.state;
        return (
            <div onClick={this.changeText} className={styles.root}>
                {greetText}
            </div>
        );
    }
}

// const createGreeter = () => {
//     const maps = new Map();
//     maps.set('test', '111112123213');
//     const greet = document.createElement('div');
//     greet.textContent = config.greetText + maps.get('test');
//     return greet;
// }

// export default createGreeter;